﻿<Window x:Class="CodeSample.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        DataContext="{Binding RelativeSource={RelativeSource Self}}"
        Title="Code Samples Broswer" 
        Height="499" 
        Width="680"
        Closing="Window_Closing" 
        FontFamily="Lucida Sans Unicode" 
        FontWeight="Normal" 
        Icon="/Code Sample;component/Images/simple%20samples2.png"
        >
    <DockPanel Name="dckpnlMainPanel">
        <Menu IsMainMenu="True" 
              DockPanel.Dock="Top" 
              Height="23" 
              FontFamily="Lucida Sans Unicode" >
            <MenuItem Name="mniSample" 
                      Header="_Sample" >
                <MenuItem Name="mniAddSample" 
                          Header="_Add new sample" 
                          Click="mniAddSample_Click">
                </MenuItem>
                <Separator/>
                <MenuItem Name="mniCopySampleCode" 
                          Header="_Copy code to clipboard" 
                          IsEnabled="False" 
                          Click="mniCopySampleCode_Click">
                </MenuItem>
                <MenuItem Name="mniEditSample" 
                          Header="_Edit sample" 
                          IsEnabled="False" 
                          Click="mniEditSample_Click">
                </MenuItem>
                <MenuItem Name="mniRemoveSample" 
                          Header="_Remove sample" 
                          IsEnabled="False" 
                          Click="mniRemoveSample_Click">
                </MenuItem>
            </MenuItem>

            <MenuItem Header="_Tools">
                <MenuItem Header="_Add new code samples from file" 
                          Name="mniAddSamplesFromFile"
                          Click="mniAddSamplesFromFile_Click">
                </MenuItem>
            </MenuItem>

            <MenuItem Header="_Appearance">
                <MenuItem Header="_Background" Name="mniBackground">
                    <MenuItem Name="mnibckgrndWhite" 
                              Background="White" 
                              Header="White" 
                              Click="mniBackground_Clicked" 
                              IsChecked="True">
                    </MenuItem>
                    <MenuItem Name="mnibckgrndGray" 
                              Background="#8D96A8" 
                              Header="Gray" 
                              Click="mniBackground_Clicked">
                    </MenuItem>
                    <MenuItem Name="mnibckgrndGrayGreen" 
                              Background="#3F5F5F" 
                              Header="Gray Green" 
                              Click="mniBackground_Clicked">
                    </MenuItem>
                    <MenuItem Name="mnibckgrndGreen" 
                              Background="#009966" 
                              Header="Green" 
                              Click="mniBackground_Clicked">
                    </MenuItem>
                    <MenuItem Name="mnibckgrndDeepGreen" 
                              Background="#007845" 
                              Header="Deep Green" 
                              Click="mniBackground_Clicked">
                    </MenuItem>
                    <MenuItem Name="mnibckgrndLightBlue" 
                              Background="#0099CC" 
                              Header="Light Blue" 
                              Click="mniBackground_Clicked">
                    </MenuItem>
                    <MenuItem Name="mnibckgrndBlueFacebook" 
                              Background="#3B5998" 
                              Header="Blue Facebook" 
                              Click="mniBackground_Clicked">
                    </MenuItem>
                    <MenuItem Name="mnibckgrndDeepBlue" 
                              Background="#003366" 
                              Header="Deep Blue" 
                              Click="mniBackground_Clicked">
                    </MenuItem>
                    <MenuItem Name="mnibckgrndPurpleBlue" 
                              Background="#663399" 
                              Header="Purple Blue" 
                              Click="mniBackground_Clicked">
                    </MenuItem>
                    <MenuItem Name="mnibckgrndPurple" 
                              Background="#9C0063" 
                              Header="Purple" 
                              Click="mniBackground_Clicked">
                    </MenuItem>
                    <MenuItem Name="mnibckgrndOrange" 
                              Background="#FF542E" 
                              Header="Orange" 
                              Click="mniBackground_Clicked">
                    </MenuItem>
                    <MenuItem Name="mnibckgrndOrangeRed" 
                              Background="OrangeRed" 
                              Header="Orange Red" 
                              Click="mniBackground_Clicked">
                    </MenuItem>
                    <MenuItem Name="mnibckgrndRed" 
                              Background="#FA0026" 
                              Header="Red" 
                              Click="mniBackground_Clicked">
                    </MenuItem>
                </MenuItem>

                <MenuItem Header="_Theme" Name="mniTheme">
                    <MenuItem Header="Apple Texture" 
                              IsCheckable="True" 
                              Name="mnithmAppleTexture"
                              Click="mniTheme_Checked">
                    </MenuItem>
                    <MenuItem Header="Wood Texture" 
                              IsCheckable="True" 
                              Name="mnithmWoodTexture"
                              Click="mniTheme_Checked">
                    </MenuItem>
                    <MenuItem Header="Green Leaves" 
                              IsCheckable="True" 
                              Name="mnithmGreenLeaves"
                              Click="mniTheme_Checked">
                    </MenuItem>
                    <MenuItem Header="Flowers" 
                              IsCheckable="True" 
                              Name="mnithmFlowers"
                              Click="mniTheme_Checked">
                    </MenuItem>
                </MenuItem>
            </MenuItem>

            <MenuItem Header="_Help">
                <MenuItem Header="_About" 
                          Name="mniAbout" 
                          Click="mniAbout_Click">
                </MenuItem>
            </MenuItem>
        </Menu>

        <StatusBar DockPanel.Dock="Bottom" 
                   Height="23" 
                   Name="statusBar1">
            <StatusBar.ItemsPanel>
                <ItemsPanelTemplate>
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="80"/>
                            <ColumnDefinition Width="100"/>
                        </Grid.ColumnDefinitions>
                    </Grid>
                </ItemsPanelTemplate>
            </StatusBar.ItemsPanel>

            <StatusBarItem>
                <TextBlock Name="txtStatus" 
                           TextWrapping="NoWrap" 
                           TextTrimming="CharacterEllipsis" 
                           FontFamily="Lucida Sans Unicode">
                </TextBlock>
            </StatusBarItem>

            <StatusBarItem Grid.Column="1">
                <TextBlock Name="txtListCount" 
                           TextWrapping="NoWrap" 
                           TextTrimming="CharacterEllipsis" 
                           FontFamily="Lucida Sans Unicode">
                    Samples:
                </TextBlock>
            </StatusBarItem>

            <StatusBarItem Grid.Column="2">
                <ProgressBar Name="grgrssbar" 
                             Value="20" 
                             Width="90" 
                             Height="12"
                             VerticalAlignment="Center" 
                             HorizontalAlignment="Center"
                             Opacity="0"/>
            </StatusBarItem>
        </StatusBar>

        <Grid Name="grdBackGrid">
            <Grid.RowDefinitions>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>

            <Grid Name="grdMainGrid">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="*"/>
                </Grid.RowDefinitions>

                <Grid Grid.Row="0" Name="grdHeaderGrid">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="200"/>
                        <ColumnDefinition Width="*"/>
                    </Grid.ColumnDefinitions>

                    <ComboBox Name="cbbLanguage" 
                              Margin="5" 
                              ItemsSource="{Binding CbbHeader}" 
                              SelectedIndex="0" 
                              SelectionChanged="cbbLanguage_SelectionChanged" 
                              FontFamily="Lucida Sans Unicode" 
                              FontSize="12" 
                              Padding="5">
                    </ComboBox>

                    <Label Grid.Column="1" 
                           Name="lblName" Margin="5" 
                           FontSize="12" 
                           Foreground="Black"
                           FontFamily="Lucida Sans Unicode" 
                           Background="Transparent" 
                           Opacity="1">
                        <Label.ContextMenu>
                            <ContextMenu>
                                <MenuItem Name="cntxtmnEditNameLabel" 
                                          Header="Edit"
                                          Click="mniEditSample_Click">
                                </MenuItem>
                            </ContextMenu>
                        </Label.ContextMenu>
                    </Label>
                </Grid>

                <Grid Grid.Row="1" 
                      Name="grdBodyGrid">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="200"/>
                        <ColumnDefinition SharedSizeGroup="column1"/>
                    </Grid.ColumnDefinitions>

                    <Grid Name="grdLeftBodyGrid"
                          Margin="5, 5, 0, 5">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="*"/>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                        </Grid.RowDefinitions>

                        <ListView Grid.Row="0" 
                                  Name="lstVResult" 
                                  Margin="0, 0, 0, 5" 
                                  ItemsSource="{Binding LstVHeader}"
                                  MouseDoubleClick="lstVResult_MouseDoubleClick" 
                                  SelectionChanged="lstVResult_SelectionChanged" 
                                  KeyDown="lstVResult_KeyDown"
                                  FontFamily="Lucida Sans Unicode"
                                  ScrollViewer.HorizontalScrollBarVisibility="Hidden">
                            <ListView.View>
                                <GridView>
                                    <GridView.Columns>
                                        <GridViewColumn Header="Lang" 
                                                        Width="60"
                                                        DisplayMemberBinding="{Binding Language}">
                                        </GridViewColumn>
                                        <GridViewColumn Header="Name" 
                                                        Width="140"
                                                        DisplayMemberBinding="{Binding Name}">
                                        </GridViewColumn>
                                    </GridView.Columns>
                                </GridView>
                            </ListView.View>

                            <ListView.ContextMenu>
                                <ContextMenu Name="cntxtmnAtSampleList" 
                                             Opened="cntxtmnAtSampleList_Opened">
                                    <MenuItem Header="Copy code to clipboard" 
                                              Name="cntxtmnCopySampleCode"
                                              Click="mniCopySampleCode_Click">
                                    </MenuItem>
                                    <MenuItem Header="Edit sample" 
                                              Name="cntxtmnEditSample"
                                              Click="mniEditSample_Click">
                                    </MenuItem>
                                    <MenuItem Header="Remove sample" 
                                              Name="cntxtmnRemoveSample"
                                              Click="mniRemoveSample_Click">
                                    </MenuItem>
                                </ContextMenu>
                            </ListView.ContextMenu>
                        </ListView>

                        <Button Grid.Row="1" 
                                Name="btnAddSample" 
                                Margin="5, 0, 0, 0"
                                Click="mniAddSample_Click">
                            +
                        </Button>

                        <Grid Grid.Row="2">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="35"/>
                            </Grid.ColumnDefinitions>
                            <TextBox Name="txtSearch" 
                                     Margin="5, 5, 0, 5" 
                                     Opacity="1"
                                     Background="White" 
                                     Foreground="Black"
                                     KeyDown="txtSearch_KeyDown" 
                                     FontFamily="Lucida Sans Unicode">
                                Search
                            </TextBox>

                            <Button Grid.Column="1" 
                                    Margin="0, 5, 0, 5" 
                                    Click="Button_Click">
                                X
                            </Button>
                        </Grid>
                    </Grid>
                    
                    <GridSplitter Width="5" 
                                  Grid.Column="1" 
                                  HorizontalAlignment="Left"
                                  VerticalAlignment="Stretch"
                                  Background="Transparent">
                    </GridSplitter>

                    <Grid Grid.Column="1" 
                          Name="grdRightBodyGrid">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="5*">
                            </RowDefinition>
                            <RowDefinition Height="2*"
                                           SharedSizeGroup="row1">
                            </RowDefinition>
                        </Grid.RowDefinitions>

                        <RichTextBox Name="rchtxtCode" 
                                     Margin="5" 
                                     IsReadOnly="True" 
                                     IsReadOnlyCaretVisible="False" 
                                     VerticalScrollBarVisibility="Auto"
                                     KeyDown="txtCodeDescription_KeyDown">
                            <RichTextBox.ContextMenu>
                                <ContextMenu>
                                    <MenuItem Click="mniCopySampleCode_Click" 
                                              Header="Copy all code to clipboard">
                                    </MenuItem>
                                    <MenuItem Name="mniCopySelection" 
                                              Click="mniCopySelection_Click" 
                                              Header="Copy selection to clipboard">
                                    </MenuItem>
                                </ContextMenu>
                            </RichTextBox.ContextMenu>
                        </RichTextBox>

                        <GridSplitter Height="5"
                                      Grid.Row="0"
                                      VerticalAlignment="Bottom" 
                                      HorizontalAlignment="Stretch"
                                      Background="Transparent">
                        </GridSplitter>

                        <TextBox Grid.Row="1" 
                                 Name="txtDesc" 
                                 Margin="5" 
                                 IsReadOnly="True" 
                                 Foreground="Black"
                                 TextWrapping="Wrap" 
                                 IsReadOnlyCaretVisible="False"  
                                 Opacity="1"
                                 VerticalScrollBarVisibility="Auto" 
                                 FontFamily="Lucida Sans Unicode" 
                                 KeyDown="txtCodeDescription_KeyDown">
                        </TextBox>
                    </Grid>
                </Grid>
            </Grid>
        </Grid>
    </DockPanel>
</Window>
